package com.elbis.business.manager;

import com.elbis.business.entity.Game;
import com.elbis.business.entity.locale.City;
import com.elbis.business.entity.locale.Country;
import com.elbis.business.entity.locale.Language;

public class Util {

	private Util() {
	}

	public static City createNewCity(Country country, String name) {
		City city = new City();
		city.setName(name);
		city.setCountry(country);
		country.getCities().add(city);
		LocaleManager.updateCountry(country);
		return city;
	}

	public static Country createNewCountry(String code, String name) {
		Country country = new Country();
		country.setCode(code);
		country.setName(name);
		LocaleManager.saveNewCountry(country);
		return country;
	}

	public static Language createNewLanguage(String code, String name) {
		Language lang = new Language();
		lang.setCode(code);
		lang.setName(name);
		LocaleManager.saveNewLanguage(lang);
		return lang;
	}

	public static Game createNewGame(String name) {
		Game newGame = new Game();
		newGame.setName(name);
		GameManager gm = new GameManager();
		gm.save(newGame);
		return newGame;
	}

}
